<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<div></div>
	<script type="text/javascript">
		let str = "<h2>111</h2>"
		let str2 = "111"

		let div = document.getElementsByTagName("div")[0]
		//innerText 以文本的形式读写内容

		div.innerText = str
		div.innerText = str2
		console.log(div.innerText)

		// innerHTML 以代码的形式读写内容
		div.innerHTML = str
		console.log(div.innerHTML)//<h2>111</h2>
		console.log(div.innerText)//111
	</script>
</body>
</html>